import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly
import plotly.graph_objects as go
from IPython.display import clear_output, HTML, display
import warnings
x = np.linspace(-100, 100, 500)
y = 2./x
fig, ax = plt.subplots(figsize = (8,8), dpi = 100)
ax.plot(x, y)
ax.set_xlabel("x")
ax.set_ylabel("y")
plt.axhline(color='black', lw=0.5)
plt.axvline(color='black', lw=0.5)
<matplotlib.lines.Line2D at 0x7fb9bcba68e0>
plotly.offline.init_notebook_mode(connected=True)
warnings.filterwarnings('ignore')
%matplotlib notebook
%config InlineBackend.figure_format = 'retina'
xlist = np.linspace(-1.0, 1.0, 100)
ylist = np.linspace(-1.0, 1.0, 100)
X, Y = np.meshgrid(xlist, ylist)
Z = np.log10(2 - X*Y)
fig = go.Figure(data=
go.Contour(
z=Z,
contours=dict(
coloring ='heatmap',
showlabels = True, # show labels on contours
labelfont = dict( # label font properties
size = 12,
color = 'white',
)),
x0=xlist[0],
dx=xlist[1] - xlist[0],
dy=ylist[1] - ylist[0],
y0=ylist[0],
))
fig.update_layout(height=800, width=800)
plotly.offline.iplot(fig)
#fig.write_image("./fig1.pdf")
xlist = np.linspace(-100.0, 100.0, 1000)
ylist = np.linspace(-100.0, 100.0, 1000)
xlist_1 = xlist[-xlist*ylist + np.array([2]*len(xlist)) > 0]
ylist_1 = ylist[-xlist*ylist + np.array([2]*len(xlist)) > 0]
X, Y = np.meshgrid(xlist, ylist)
X
Z = np.log10(2 - X*Y)
fig = go.Figure(data=[go.Surface(z=Z)])
fig.update_traces(contours_z=dict(show=True, usecolormap=True,
highlightcolor="limegreen", project_z=True))
fig.update_layout(title='Mt Bruno Elevation', autosize=False,
scene_camera_eye=dict(x=1.87, y=0.88, z=-0.64),
width=500, height=500,
margin=dict(l=65, r=50, b=65, t=90)
)
plotly.offline.iplot(fig)